﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace PersonaLibrary.Converters
{
	public class FromBoolToBold : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (value is FontWeight)
			{
				FontWeight from = (FontWeight)value;

				return from == FontWeights.Bold;
			}

			return value;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (value is bool)
			{
				bool from = (bool)value;
				if (from)
					return FontWeights.Bold;
			}

			return FontWeights.Normal;
		}
	}
}
